package com.efast.dmom.mgmt.controller.les;

import com.efast.cafe.framework.bean.ResultBean;
import com.efast.dmom.mgmt.entity.les.TwDocAsnDetails;
import com.efast.dmom.mgmt.service.les.TwDocAsnDetailsService;
import com.efast.dmom.mgmt.utils.Assist;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import io.swagger.annotations.Api;

@Controller
@RequestMapping(value = "/twDocAsnDetails")
@Api(value = "/twDocAsnDetails", description = "ASN Details")
public class TwDocAsnDetailsController {

	@Autowired
	private TwDocAsnDetailsService twDocAsnDetailsService;

	// ASN DETAIL 的创建
	@RequestMapping(value = "/save" , method=RequestMethod.POST)
	public @ResponseBody ResultBean save(@RequestBody TwDocAsnDetails twDocAsnDetails) {
		ResultBean result = new ResultBean(true, "'");
		twDocAsnDetailsService.insertTwDocAsnDetails(twDocAsnDetails);
		return result;
	}

	// ASN DETAIL的关闭操作[ASN DETAIL订单行状态改为关闭10]
	@RequestMapping(value = "/close" , method=RequestMethod.POST)
	public @ResponseBody ResultBean close(@RequestBody TwDocAsnDetails twDocAsnDetails) {
		ResultBean result = new ResultBean(true, "'");
		twDocAsnDetails.setLineStatus("10");
		twDocAsnDetailsService.updateNonEmptyTwDocAsnDetailsById(twDocAsnDetails);
		return result;
	}

	// ASN DETAIL的编辑操作
	@RequestMapping(value = "/edit" , method=RequestMethod.POST)
	public @ResponseBody ResultBean edit(@RequestBody TwDocAsnDetails twDocAsnDetails) {
		ResultBean result = new ResultBean(true, "'");
		Assist assist = new Assist();
		twDocAsnDetailsService.updateTwDocAsnDetails(twDocAsnDetails, assist);
		return result;
	}

}
